/**
 @Name：系统日志
 @Author：cike
 @Date：2019-5-26
**/

layui.define(['table', 'form'], function(exports){
  var $ = layui.$
  ,admin = layui.admin
  ,view = layui.view
  ,table = layui.table
  ,setter = layui.setter
  ,form = layui.form;

  // table设置
  table.set({
    where: {
      access_token: layui.data(setter.tableName)[setter.request.tokenName]
    }
    ,method: 'post'
    ,response:{
      statusCode: 200
    }
    ,request:{
      pageName: "page"
      ,limitName: "size"
    }
    ,page: true
    ,text: { none : "暂无相关数据" }
    ,done: function (res) {
      if(res[setter.response.statusCode] == setter.response.statusCode.logout){
        view.exit();
      }
    }
    ,parseData: function(res){ //res 即为原始返回的数据
      return {
        "code": res.code, //解析接口状态
        "msg": res.msg, //解析提示文本
        "count": res.data.total, //解析数据长度
        "data": res.data.list //解析数据列表
      };
    }
  });
  
  //系统日志
  table.render({
    elem: '#back-log-list'
    ,url: setter.api_back_log_list
    ,cols: [[
      {field: 'user_id', width: 80, title: '账号ID'}
      ,{field: 'user_name', width: 100, title: '账号'}
      ,{field: 'user_type', width: 100, title: '类型'}
      ,{field: 'permission', width: 200, title: '目录'}
      ,{field: 'path', width: 200, title: '路径'}
      ,{field: 'data', title: '发送数据',templet: function(d){
        // delete d.LAY_INDEX;
        // delete d.LAY_TABLE_INDEX;
        return JSON.stringify(d.data);
      }}
      ,{field: 'create_time', width: 200, title: '创建时间'}
    ]]
  });
  exports('log', {})
});